package com.qf.controller;

import com.qf.feign.TestProviderFeign;
import com.qf.pojo.User;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaojian
 */
@RestController
@RequestMapping("/custom")
@Api(tags = "测试模块",value = "springcloudalibaba",description = "测试接口")
@RefreshScope
public class TestController {

    @Value("${version}")
    private String version;

    @Autowired
    private TestProviderFeign testProviderFeign;



    @ApiOperation(value = "测试方法")
    @GetMapping("/test")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "username",value = "用户名"),
            @ApiImplicitParam(name = "password",value = "密码")
    })
    @ApiResponses({
            @ApiResponse(code = 401,message = "没有认证"),
            @ApiResponse(code = 500,message = "后端控制台错误")
    })
    public String test(User user, String username, String password) {
        String str = testProviderFeign.test();
        return str+version;
    }
}